<!DOCTYPE html>
<html lang="zh-cn" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:v-bind="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="referrer" content="origin-when-crossorigin"/>
    <meta name="description" content="学习无涯"/>
    <meta property="og:description" content="学习无涯"/>
    <meta http-equiv="Cache-Control" content="no-transform"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <title>AlwaysLearning - 房贷利率敏感度分析工具</title>
    <link rel="shortcut icon" href="./img/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="./css/pintuer-2.0.custom.min.css"/>
    <link rel="stylesheet" href="./css/house-interest-analysis.css"/>
    <script src="./js/jquery-3.4.1.min.js"></script>
    <script src="./js/pintuer-2.0.min.js"></script>
    <script src="./js/vue.js"></script>
    <script src="./js/echarts.js"></script>
  </head>
  <body>
    <main class="layout container">
      <h1 class="title">房贷利率敏感度分析工具</h1>
      <div class="input-panel">
        <div>首付百分比</div>
        <div class="input-row">
            <input v-model="downPaymentRateInput" placeholder="首付百分比，0%~100%" class="input" />
            <span>%</span>
        </div>
        <div>贷款年利率</div>
        <div class="input-row">
            <input v-model="yearlyInterestRateFromInput" placeholder="贷款年利率，1~100" class="input" />
            <span>-</span>
            <input v-model="yearlyInterestRateToInput" placeholder="贷款年利率，1~100" class="input" />
            <span>%</span>
        </div>
        <div>利率变化幅度</div>
        <div class="input-row">
            <input v-model="deltaInput" placeholder="利率变化幅度，大于0，小于1" class="input" />
            <span>%</span>
        </div>
        <div>贷款偿还月数</div>
        <div class="input-row">
            <input v-model="payMonthInput" placeholder="利贷款偿还月数，1~720" class="input" />
            <span>月</span>
        </div>
        <div>房价</div>
        <div class="input-row">
            <input v-model="totalAmountInput" placeholder="房价，单位元" class="input" />
            <span>元</span>
        </div>
      </div>
      <div class="operations">
        <button v-on:click="submit" class="button" style="margin-bottom: 1em;">分析</button>
      </div>
      <div class="error-message">{{ errMsg }}</div>
      <div id="result">
          <table class="table">
            <tr class="align-center">
                <th>
                    贷款年利率（%）
                    <button v-on:click="switchInterestRateSort">
                        <i v-if="interestAscend" class="icon-arrow-up"></i>
                        <i v-if="!interestAscend" class="icon-arrow-down"></i>
                    </button>
                </th>
                <th>首付（元）</th>
                <th>月供（元）</th>
                <th>本息偿还总额（元）</th>
                <th>利息偿还总额（元）</th>
                <th>买房总款（元）</th>
            </tr>
            <tr class="date-row align-right" v-for="result in results" v-bind:key="result.id">
              <td class="font-monospace">{{ result.yearlyInterestRate }}</td>
              <td class="font-monospace">{{ result.downPayment }}</td>
              <td class="font-monospace">{{ result.monthlyPayAmount }}</td>
              <td class="font-monospace">{{ result.totalPayment }}</td>
              <td class="font-monospace">{{ result.totalInterest }}</td>
              <td class="font-monospace">{{ result.total }}</td>
            </tr>
          </table>
      </div>
    </main>
  </body>
  <script src="./js/house-interest-analysis.js"></script>
</html>
